Passed
Pull Request — master (#42)
by
unknown
02:34
created

graph.helpers.ts ➔ getElementBBox   A

Complexity

Conditions 1

Size

Total Lines 6
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 5
dl 0
loc 6
rs 10
c 0
b 0
f 0
cc 1
1
import { ElementHandle } from 'puppeteer';
2
import { TRANSITION_DURATION } from '../../src/utils/AppConsts';
3
4
export async function waitForGraphStabilization() {
5
    await page.waitFor(500);
6
}
7
8
export async function waitForAllTransitions() {
9
    await page.waitFor(TRANSITION_DURATION);
10
}
11
12
// Replacement of element.boundingBox() - we need to get node positions within SVG container, not relative to main frame
13
export async function getElementBBox(element: ElementHandle<SVGGraphicsElement>) {
14
    return await element.evaluate(el => {
15
        const { x, y, width, height } = el.getBBox();
16
        return { x, y, width, height };
17
    });
18
}
19